using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class SubtypeofreferenceddataAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public SubtypeofreferenceddataAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v23] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v231] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v24] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v25] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v251] = HL7TableType.HL7;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v23] = new string[]{"BASIC","DICOM","FAX","GIF","JOT","JPEG","PICT","PostScript","TIFF","Octet-stream"};
						validVersionCodes[HL7Version.v231] = new string[]{"TIFF","PICT","DICOM","FAX","JOT","BASIC","Octet-stream","PostScript","JPEG","GIF","HTML","SGML","XML","RTF"};
						validVersionCodes[HL7Version.v24] = new string[]{"BASIC","DICOM","FAX","GIF","HTML","JOT","JPEG","Octet-stream","PICT","PostScript","RTF","SGML","TIFF","x-hl7-cda-level-one","XML"};
						validVersionCodes[HL7Version.v25] = new string[]{"BASIC","DICOM","FAX","GIF","HTML","JOT","JPEG","Octet-stream","PICT","PostScript","RTF","SGML","TIFF","x-hl7-cda-level-one","XML"};
						validVersionCodes[HL7Version.v251] = new string[]{"BASIC","DICOM","FAX","GIF","HTML","JOT","JPEG","Octet-stream","PICT","PostScript","RTF","SGML","TIFF","x-hl7-cda-level-one","XML"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v23] = new string[]{"ISDN PCM audio data","Digital Imaging and Communications in Medicine","Facsimile data","Needs formal description","Electronic ink data (Jot 1.0 standard)","Needs formal description","PICT format image data","PostScript program","TIFF image data","Uninterpreted binary data"};
						validVersionDescriptions[HL7Version.v231] = new string[]{"TIFF image data","PICT format image data","Digital Imaging and Communications in Medicine","Facsimile data","Electronic ink data (Jot 1.0 standard)","ISDN PCM audio data","Uninterpreted binary data","PostScript program","Joint Photographic Experts Group","Graphics Interchange Format","Hypertext Markup Language","Structured General Markup Language (HL7 V2.3.1 and later)","Extensible Markup Language (HL7 V2.3.1 and later)","Rich Text Format"};
						validVersionDescriptions[HL7Version.v24] = new string[]{"ISDN PCM audio data","Digital Imaging and Communications in Medicine","Facsimile data","Graphics Interchange Format","Hypertext Markup Language","Electronic ink data (Jot 1.0 standard)","Joint Photographic Experts Group","Uninterpreted binary data","PICT format image data","PostScript program","Rich Text Format","Standard Generalized Markup Language (HL7 V2.3.1 and later)","TIFF image data","HL7 Clinical Document Architecture Level One document","Extensible Markup Language (HL7 V2.3.1 and later)"};
						validVersionDescriptions[HL7Version.v25] = new string[]{"ISDN PCM audio data","Digital Imaging and Communications in Medicine","Facsimile data","Graphics Interchange Format","Hypertext Markup Language","Electronic ink data (Jot 1.0 standard)","Joint Photographic Experts Group","Uninterpreted binary data","PICT format image data","PostScript program","Rich Text Format","Standard Generalized Markup Language (HL7 V2.3.1 and later)","TIFF image data","HL7 Clinical Document Architecture Level One document","Extensible Markup Language (HL7 V2.3.1 and later)"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"ISDN PCM audio data","Digital Imaging and Communications in Medicine","Facsimile data","Graphics Interchange Format","Hypertext Markup Language","Electronic ink data (Jot 1.0 standard)","Joint Photographic Experts Group","Uninterpreted binary data","PICT format image data","PostScript program","Rich Text Format","Standard Generalized Markup Language (HL7 V2.3.1 and later)","TIFF image data","HL7 Clinical Document Architecture Level One document","Extensible Markup Language (HL7 V2.3.1 and later)"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
